Plot
ggplotly(CovidDeath)
No summary function supplied, defaulting to `mean_se()`
No summary function supplied, defaulting to `mean_se()`
GiniAge=readRDS(file=url(paste0(myWeb2,"GiniAndAge.rds")))
# ggplotly(GiniAge)
myWeb3="https://raw.githubusercontent.com/tianyl27/543_coursework_3/main/"
CountryMap=readRDS(file=url(paste0(myWeb3,"CountryMap.rds")))
ggplotly(CountryMap)
linkMap="https://github.com/EvansDataScience/VAforPM_Spatial/raw/main/worldMap.geojson"
library(sf)
mapWorld=read_sf(linkMap)
base=ggplot(data=mapWorld) + geom_sf(fill='grey90',
color=NA) + theme_classic()
WHRData2021
Map2021=readRDS(file=url(paste0(myWeb3,"mapWorldVars.rds")))
# leaflet
TitleText = "Country Performance in COVID epidemic"
CaptionText = "Source: https://worldhappiness.report/ed/2021/"
theLegTitle="World_Performance\n(grey is missing)"
clusterMap= base + geom_sf(data=Map2021,
aes(fill=cluster,text=NAME),
color=NA)
Warning: Ignoring unknown aesthetics: text
clusterMap = clusterMap+ scale_fill_brewer(palette ='BuGn',
direction = -1,
name=theLegTitle)+ labs(title=TitleText,
caption=CaptionText) +
theme(plot.title = element_text(hjust = 1),
plot.caption = element_text(hjust = 0),
axis.title.x = element_blank())
# palette ='BuGn'
# Next: change the color
# How to get rid of the axis
clusterMap%>%ggplotly()
library(leaflet)
library(rgdal)
# world <- rgdal::readOGR("https://github.com/EvansDataScience/VAforPM_Dashboard/raw/main/worldMap.geojson")
m <-leaflet(Map2021) %>%addTiles()
factpal <- colorFactor(topo.colors(5), Map2021$cluster)
leaflet(Map2021) %>%addTiles() %>%
addPolygons(fillColor = ~factpal(cluster),
weight = 2,
opacity = 1,
color = "white",
dashArray = "3",
fillOpacity = 0.7,
label = ~paste(NAME,": ", cluster),
highlightOptions = highlightOptions(
weight = 5,
color = "#666",
dashArray = "",
fillOpacity = 0.7,
bringToFront = TRUE)
) %>%
addLegend("bottomright", pal = factpal, values = ~cluster,
title = "Perfomance\n(grey is missing)",
labFormat = labelFormat(prefix = ""),
opacity = 1
)
NA
NA
NA